package iterator;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class TestIterator {

    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("a", "aa");
        map.put("b", "bb");
        map.put("c", "cc");
        map.put("d", "dd");
        map.put("e", "ee");

        Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, String> next = iterator.next();
            map.remove("a");
            System.out.println(next.getKey() + " : " + next.getValue());
        }
    }
}
